﻿
<template>
<div class="card-fill layout-padding">
<el-card shadow="hover" class="layout-padding-auto" >
  <el-form ref="formRefTighteningData" :model="stateTighteningData.vmModel" label-width="100px">
    <el-row>
      
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_TID_FormItem" prop="Entity.TID" label="TID" :rules="[{ required: true, message:'TID为必填项',trigger:'blur'}]">
            <el-input-number v-model="stateTighteningData.vmModel.Entity.TID" clearable></el-input-number>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_toolSerialNum_FormItem" prop="Entity.toolSerialNum" label="toolSerialNum">
            <el-input v-model="stateTighteningData.vmModel.Entity.toolSerialNum" clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_tighteningID_FormItem" prop="Entity.tighteningID" label="tighteningID" :rules="[{ required: true, message:'tighteningID为必填项',trigger:'blur'}]">
            <el-input-number v-model="stateTighteningData.vmModel.Entity.tighteningID" clearable></el-input-number>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_tool_id_FormItem" prop="Entity.tool_id" label="tool_id" :rules="[{ required: true, message:'tool_id为必填项',trigger:'blur'}]">
            <el-input-number v-model="stateTighteningData.vmModel.Entity.tool_id" clearable></el-input-number>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_sn_FormItem" prop="Entity.sn" label="sn">
            <el-input v-model="stateTighteningData.vmModel.Entity.sn" clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_project_name_FormItem" prop="Entity.project_name" label="project_name">
            <el-input v-model="stateTighteningData.vmModel.Entity.project_name" clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_torque_FormItem" prop="Entity.torque" label="torque">
            <el-input v-model="stateTighteningData.vmModel.Entity.torque" clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_angle_FormItem" prop="Entity.angle" label="angle">
            <el-input v-model="stateTighteningData.vmModel.Entity.angle" clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_tightening_status_FormItem" prop="Entity.tightening_status" label="tightening_status">
            <el-input v-model="stateTighteningData.vmModel.Entity.tightening_status" clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_rawdata_time_FormItem" prop="Entity.rawdata_time" label="rawdata_time">
            <el-input v-model="stateTighteningData.vmModel.Entity.rawdata_time" clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_screw_id_FormItem" prop="Entity.screw_id" label="screw_id" :rules="[{ required: true, message:'screw_id为必填项',trigger:'blur'}]">
            <el-input-number v-model="stateTighteningData.vmModel.Entity.screw_id" clearable></el-input-number>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_PointNum_FormItem" prop="Entity.PointNum" label="PointNum" :rules="[{ required: true, message:'PointNum为必填项',trigger:'blur'}]">
            <el-input-number v-model="stateTighteningData.vmModel.Entity.PointNum" clearable></el-input-number>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_angle_offset_FormItem" prop="Entity.angle_offset" label="angle_offset" :rules="[{ required: true, message:'angle_offset为必填项',trigger:'blur'}]">
            <el-input-number v-model="stateTighteningData.vmModel.Entity.angle_offset" clearable></el-input-number>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_ArrTorque_FormItem" prop="Entity.ArrTorque" label="ArrTorque">
            <el-input v-model="stateTighteningData.vmModel.Entity.ArrTorque" clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_upload_status_FormItem" prop="Entity.upload_status" label="upload_status">
            <el-input v-model="stateTighteningData.vmModel.Entity.upload_status" clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_upload_time_FormItem" prop="Entity.upload_time" label="upload_time">
            <el-input v-model="stateTighteningData.vmModel.Entity.upload_time" clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_filed1_FormItem" prop="Entity.filed1" label="filed1">
            <el-input v-model="stateTighteningData.vmModel.Entity.filed1" clearable></el-input>
        </el-form-item>
    </el-col>
    <el-col :xs="24" :lg="12" class="mb20">
        <el-form-item ref="Entity_filed2_FormItem" prop="Entity.filed2" label="filed2">
            <el-input v-model="stateTighteningData.vmModel.Entity.filed2" clearable></el-input>
        </el-form-item>
    </el-col>
    </el-row>

    <div style="text-align:right;">
      <WtmButton @click="onSubmitTighteningData"  type="primary" :button-text="$t('message._system.common.vm.submit')" style="margin-top:15px;"/>
      <WtmButton @click="onCloseTighteningData"  type="primary" :button-text="$t('message._system.common.vm.cancel')" style="margin-top:15px;"/>
    </div>
  </el-form>

</el-card>
</div>
</template>


<script setup lang="ts" name="message._system.common.vm.add;false">
import {  ElMessageBox, ElMessage } from 'element-plus';
import { defineAsyncComponent,reactive, ref, getCurrentInstance, onMounted, nextTick } from 'vue';
import { TighteningDataApi } from '/@/api/record/TighteningData';
import other from '/@/utils/other';
import fileApi from '/@/api/file';
import { useRouter } from "vue-router";
const ci = getCurrentInstance() as any;

// 定义变量内容
const formRefTighteningData = ref();
const stateTighteningData = reactive({
    vmModel: {
	  Entity:{
      			TID: null,
			toolSerialNum: null,
			tighteningID: null,
			tool_id: null,
			sn: null,
			project_name: null,
			torque: null,
			angle: null,
			tightening_status: null,
			rawdata_time: null,
			screw_id: null,
			PointNum: null,
			angle_offset: null,
			ArrTorque: null,
			upload_status: null,
			upload_time: null,
			filed1: null,
			filed2: null,

      },
      
	},
    
     
});

// 取消
const onCloseTighteningData = () => {
    closeDialog();
};

// 提交
const onSubmitTighteningData = () => {
    formRefTighteningData.value?.validate((valid: boolean, fields: any) => {
		if (valid) {
            TighteningDataApi().add(stateTighteningData.vmModel).then(() => {
                ElMessage.success(ci.proxy.$t('message._system.common.vm.submittip'));
                emit('refresh');
                closeDialog();
            }).catch((error) => {
                other.setFormError(ci, error);
            })
		}
	})
};

// 页面加载时
onMounted(() => {
    
});

// 定义子组件向父组件传值/事件
const emit = defineEmits(['refresh','closeDialog']);
// 关闭弹窗
const closeDialog = () => {
    emit('closeDialog');
};
// 暴露变量
defineExpose({

});
</script>

<style scoped lang="scss">

</style>

